/*
* $Id: TableRegion.h 122 2010-07-22 17:05:50Z volok-aleksej@yandex.ru $
*
* Copyright 2009 by Volokitin Alexey
* All rights reserved
*
*/
#ifndef _TABLE_REGION_H_
#define _TABLE_REGION_H_

#include "Visual/Drawers/TableDrawer/TableDrawer.h"

#define SB_USER_UP		9
#define SB_USER_DOWN	10

class CTableRegion{
	CWnd* m_pParent;
	CRect m_rectRegion;
protected:
	CScrollBar m_HScroll;
	CScrollBar m_VScroll;
	bool m_bHScroll;
	bool m_bVScroll;
protected:
	CTableDrawer m_tableDrawer;
	CPoint m_nBeginPosResize;
protected:
	void UpgradeScroll();
	void MoveScroll();
public:
	CTableRegion(IWnd* pParent);
	~CTableRegion();
public:
	void SetRect(CRect rect);
	void Create(CWnd* pParent);
	void Paint(CDC* dc);
	void SetCursor(CPoint pos);
	bool IsResize();
	void Resize();
	bool MouseLBtnDown(CPoint point);
	bool IsScroll(CScrollBar* pScroll);
	bool IsScroll(int nType);
	CScrollBar* GetScroll(int nType);
	void Scroll(UINT nSBCode, CScrollBar* pScroll);
	void OffsetSelection(bool bUp);
	bool IsSelectRow();
	CTableDrawer* GetTableDrawer();
};

#endif/*_TABLE_REGION_H_*/